<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            width: 400px;
            height: 350px;
            background-color: pink;
        }
        .images{
            height: 250px;
        }
        img{
            width: 400px;
            height: 250px;
        }
        .cr{
            height: 100px;
            padding-left: 5px;
        }
        ul{
            display: flex;
        }
        p{
            height: 50px;
            line-height: 50px;
            color: red;
        }
        ul{
            padding:0px 20px;
        }
        li{
            padding: 0 8px;
            color: gray;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="images"><img src="../images/1.webp" alt=""></div>
        <div class="cr">
            <p>我不在家</p>
            <ul>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </div>
    <script>
        const sliderData = [
      { url: '../images/1.webp', title: '我为什么没有一头美丽的秀发', color: 'rgb(100, 67, 68)' },
      { url: '../images/2.webp', title: '古娜拉黑暗之神！哈哈哈啊！', color: 'rgb(43, 35, 26)' },
      { url: '../images/3.webp', title: '骑着我心爱的小摩托~', color: 'rgb(36, 31, 33)' },
      { url: '../images/4.webp', title: '喜欢植物', color: 'rgb(139, 98, 66)' },
      { url: '../images/5.webp', title: '我要和弟弟争夺皇位', color: 'rgb(67, 90, 92)' },
      { url: '../images/6.webp', title: '哔哩哔哩小年YEAH', color: 'rgb(166, 131, 143)' },
      { url: '../images/7.webp', title: '一站式解决你的电脑配置问题！！！', color: 'rgb(53, 29, 25)' },
      { url: '../images/8.webp', title: '谁不想和小猫咪贴贴呢！', color: 'rgb(99, 72, 114)' },
    ]
    let a = Math.floor(Math.random()*sliderData.length)
    const lis = document.querySelectorAll('li')
    lis[a].style.color='white'
    const img = document.querySelector('img')
    img.src = sliderData[a].url
    const bgr = document.querySelector('.cr')
    bgr.style.backgroundColor = sliderData[a].color
    const p = document.querySelector('p')
    p.innerHTML = sliderData[a].title
    
    </script>
</body>
</html>